﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="RegAsesores.aspx.cs" Inherits="AppGisena.Presentacion.Up.RegAsesores" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<!DOCTYPE html>



     

<html>

<head runat="server">
    <title>Registro de Asesor de la U.P.</title>
  
    
    <style>
        .cbStates-list {
            width : 298px;
            font  : 11px tahoma,arial,helvetica,sans-serif;
        }
        
        .cbStates-list th {
            font-weight : bold;
        }
        
        .cbStates-list td, .cbStates-list th {
            padding : 3px;
        }

        .list-item {
            cursor : pointer;
        }
    </style>
</head>


<body>
 
        <form id="form1" runat="server">
    <ext:ResourceManager runat="server" />
    
    
  
    
    <ext:FormPanel 
        ID="FormPanPrinc" 
        runat="server"
        Title="REGISTRO ASESORES A LA UNIDAD PRODUCTIVA"
        Width="600" 
        Height="600"        
        BodyPadding="10"
        DefaultAnchor="100%"
         Layout="AutoLayout"
         StyleSpec="position:absolute;top: 10%;left: 30%;width: 77px; height: 78px;margin-top: -39px; margin-left: -39px;"
        UI="Success">

      <%--Form Panel Principal  --%>
                

        <Items>
            
            <ext:FieldContainer 
                runat="server" 
                MsgTarget="Side"
                CombineErrors="true"
                FieldLabel="Codigo Up"
                Layout="HBoxLayout">
                  <Items>
                        <ext:NumberField   ID="Txt_Cod_Up" runat="server" MaxLeng="20"  AllowBlank="false" Width="150" />
                          <ext:Toolbar     runat="server"       Flex="1"     Flat="true">   
                        <Items>
                            <ext:Button ID="Btn_Buscar_Up_Sofia" runat="server" Text="Buscar..." Icon="Zoom" >
                                   <DirectEvents>
                                   <Click OnEvent="Btn_BuscarUPGISENA_Click">
                                   <EventMask ShowMask="true" Msg="Buscando..." MinDelay="500" />
                                  </Click>
                           </DirectEvents>
                         </ext:Button>
                            
                        </Items>
                    </ext:Toolbar>
                  </Items>

                  </ext:FieldContainer>

        </Items>



        <Items>

         <%--Contenedor datos basicos de la up sofia  --%>

            <ext:FieldSet 
                runat="server"
                Title="DETALLE DE LA UP"
                DefaultAnchor="100%">
                <Defaults>
                    <ext:Parameter Name="labelWidth" Value="89" Mode="Raw" />
                </Defaults>
                <Items>
               
                      

                     <ext:FieldContainer 
                runat="server" 
                FieldLabel="Nombre Up" 
                AnchorHorizontal="100%" 
                Layout="HBoxLayout">                                       
                <Items>
                    <ext:TextField ID ="Txt_Nomb_UP2" runat="server" Width="250" Margins="0 3 0 0" ReadOnly="true"/>                    
                </Items>
            </ext:FieldContainer>

                 


                    <%-- Numero de actas sofia plus al registro ya seleccionado --%>

                <ext:FieldContainer 
                runat="server" 
                FieldLabel="Cod. Centro" 
                AnchorHorizontal="100%" 
                Layout="HBoxLayout">                                       
                <Items>
                      
                      <ext:TextField ID="Txt_Cod_Cent_Form2" runat="server" Width="250" Margins="0 3 0 0" ReadOnly="true"/>                  
                </Items>
            </ext:FieldContainer>


             <%-- Numero de la ficha --%>

                <ext:FieldContainer 
                runat="server" 
                FieldLabel="No. Ficha" 
                AnchorHorizontal="100%" 
                Layout="HBoxLayout">                                       
                <Items>
                    <ext:TextField   ID="Txt_NFicha_UP2" runat="server" Width="250" Margins="0 3 0 0" ReadOnly="true"/>                    
                </Items>
            </ext:FieldContainer>

                </Items>




            </ext:FieldSet>
        </Items>

        

           <Items>

         <%--Contenedor datos basicos de la up sofia  --%>

            <ext:FieldSet 
                runat="server"
                Title="DATOS DE LOS NUEVOS ASESORES"
                DefaultAnchor="100%">
                <Defaults>
                    <ext:Parameter Name="labelWidth" Value="89" Mode="Raw" />
                </Defaults>
                <Items>

                      <%--Se listar todos los instructores de la unidad productiva  --%>
                    
                      <ext:FieldContainer  runat="server"   MsgTarget="Side"  CombineErrors="true"  FieldLabel="Instructores de Sofia Plus"   Layout="HBoxLayout">    
                                   
                          <Items>
                                <ext:ComboBox 
            ID="Slb_Rol_Asesr" 
            runat="server"
            EmptyText="Seleccione el Asesor"
            TypeAhead="true"
            ForceSelection="true"
            DisplayField="Nombre" 
            ValueField="ident"
            MinChars="1"
            MatchFieldWidth="false" 
            PageSize="20"
            Width="400">
            <Store>
                <ext:Store ID="Str_Asesor" runat="server" IsPagingStore="true" PageSize="10">
                    <Model>
                        <ext:Model runat="server">
                            <Fields>
                                <ext:ModelField Name="ident" />
                                <ext:ModelField Name="Nombre" />
                                <ext:ModelField Name="Correo" />
                                 <ext:ModelField Name="Celular" />
                                 <ext:ModelField Name="FechaFinalCont" />
                            </Fields>
                        </ext:Model>
                    </Model>            
                </ext:Store>
            </Store>
            <ListConfig Width="320" Height="300" ItemSelector=".x-boundlist-item">
                <Tpl runat="server">
                    <Html>
					    <tpl for=".">
						    <tpl if="[xindex] == 1">
							    <table class="cbStates-list">
								    <tr>
									    <th>ident</th>
									    <th>Nombre</th>
                                        <th>Correo</th>
                                         <th>Celular</th>
                                         <th>FechaFinalCont</th>
								    </tr>
						    </tpl>
						    <tr class="x-boundlist-item">
							    <td>{ident}</td>
							    <td>{Nombre}</td>
                                <td>{Correo}</td>
                                <td>{Celular}</td>
                                <td>{FechaFinalCont}</td>
						    </tr>
						    <tpl if="[xcount-xindex]==0">
							    </table>
						    </tpl>
					    </tpl>
				    </Html>
                </Tpl>                              
            </ListConfig>           
            <Triggers>
                <ext:FieldTrigger Icon="Clear" HideTrigger="true" />
            </Triggers>
            <Listeners>
                <BeforeQuery Handler="this.getTrigger(0)[this.getRawValue().toString().length == 0 ? 'hide' : 'show']();" />
                <TriggerClick Handler="if (index == 0) { 
                                           this.focus().clearValue(); 
                                           trigger.hide();
                                       }" />
                <Select Handler="this.getTrigger(0).show();" />
            </Listeners>
        </ext:ComboBox>        
                              </Items>

                         <Items>
                          <ext:Toolbar     runat="server"       Flex="1"     Flat="true">   
                        <Items>
                            <ext:Button ID="Btn_Asesor_Nuevo" runat="server" Text="Nuevo" Icon="UserBrown">
                                   <DirectEvents>
                                   <Click OnEvent="Btn_Asesor_Nuevo_Click">
                                   <EventMask ShowMask="true" Msg="Cargando..." MinDelay="500" />
                                  </Click>
                           </DirectEvents>
                         </ext:Button>
                            
                        </Items>
                    </ext:Toolbar>

                       </Items>


                         </ext:FieldContainer>
               
         <%--Se lista los roles de los asesores --%>
                    <ext:FieldContainer  runat="server"   MsgTarget="Side" CombineErrors="true"  FieldLabel="Seleccione el Rol"   Layout="HBoxLayout">    
                                   
                          <Items>

                                <ext:MultiCombo runat="server" Width="300" ID="cmb_rol_asesor"  ValueField="Id_Tp_Rol" DisplayField="Nomb_Rol"   EmptyText="Seleccione el Rol" >
                            <Store>
                                 <ext:Store runat="server" ID="Str_Rol_Asesor">
                                <Model>
                                        <ext:Model runat="server">
                                        <Fields>
                                        <ext:ModelField Name="Id_Tp_Rol" Type="Int" />
                                        <ext:ModelField Name="Nomb_Rol" Type="String"/>
                                        </Fields>
                                        </ext:Model>
                                 </Model>            
                                </ext:Store>    
                            </Store> 
                         </ext:MultiCombo>



                              </Items>
                         </ext:FieldContainer>
                      
                      


                    
                 <ext:Toolbar     runat="server"       Flex="1"     Flat="true">   
                        <Items>
                            <ext:Button ID="Btn_Nuevo_Asesor" runat="server" Text="Registrar" Icon="UserAdd">
                                   <DirectEvents>
                                   <Click OnEvent="Btn_Registrar_Asesor_Click">
                                   <EventMask ShowMask="true" Msg="Registrando..." MinDelay="500" />
                                  </Click>
                           </DirectEvents>
                         </ext:Button>
                            
                        </Items>
                    </ext:Toolbar>
                     
                </Items>



            </ext:FieldSet>

  



<ext:FieldSet 
                runat="server"
                Title="LISTADO DE ASESORES DE LA U.P."
                DefaultAnchor="100%">
                <Defaults>
                    <ext:Parameter Name="labelWidth" Value="89" Mode="Raw" />
                </Defaults>
           


               <Items>
 
                    
                    <ext:GridPanel
                    runat="server" 
                    Header="false"
                    Border="false">                         
                    <Store>
                         <%--Data Grid Asesores Ofertado --%>
                        <ext:Store ID="Str_Asesores_Ip" runat="server" PageSize="10">
                            <Model>
                                <ext:Model runat="server" IDProperty="IDENTIFICACION">
                                    <Fields>
                                       
                                        <ext:ModelField Name="Identificacion" Type="Int" />
                                        <ext:ModelField Name="Nombre" Type="String"/>
                                        <ext:ModelField Name="Nomb_Rol" Type="String" />
                                        
                                    </Fields>
                                </ext:Model>
                            </Model>
                        </ext:Store>
                    </Store>
                    <ColumnModel runat="server">
                        <Columns>
                             <ext:Column runat="server" 
                                Text="IDENTIFICACION" 
                                Width="30" 
                                Sortable="true" 
                                DataIndex="Identificacion" 
                                />
                            <ext:Column runat="server" 
                                Text="ASESOR" 
                                Width="60" 
                                Sortable="true" 
                                DataIndex="Nombre" 
                                />
                            <ext:Column runat="server" 
                                Text="ROL" 
                                Width="80" 
                                Sortable="true" 
                                DataIndex="Nomb_Rol"
                                Flex="1" 
                                />
                       
                           
                            <ext:Column runat="server" 
                               
                                Width="20" 
                                Sortable="true" 
                                Flex="1"   >
                             <Commands>
                             <ext:ImageCommand CommandName="Edit" Icon="Delete" Text="Borrar">
                                <ToolTip Text="Edit" />
                             </ext:ImageCommand>
                             </Commands>
                             <Listeners>
                             <Command  Handler="#{DirectMethods}.BorrarAsesor(record.data.Identificacion);" />
                             </Listeners>
                              </ext:Column>



                        </Columns>
                    </ColumnModel>
                    <View>
                        <ext:GridView runat="server" LoadMask="false" />
                    </View>
                    <Features>
                        <ext:GridFilters runat="server" Local="true">
                            <Filters>
                                <ext:NumericFilter DataIndex="ID" />
                                <ext:StringFilter DataIndex="Name" />
                                <ext:DateFilter DataIndex="Start">
                                    <DatePickerOptions runat="server" TodayText="Now" />
                                </ext:DateFilter>
                                <ext:DateFilter DataIndex="End">
                                    <DatePickerOptions runat="server" TodayText="Now" />
                                </ext:DateFilter>                        
                                <ext:BooleanFilter DataIndex="Completed" />
                            </Filters>
                        </ext:GridFilters>
                    </Features>
                    <BottomBar>
                        <ext:PagingToolbar 
                            runat="server" 
                            DisplayInfo="true"
                            DisplayMsg="Mostrando Productos {0} - {1} of {2}"
                            />
                    </BottomBar>
                </ext:GridPanel>
                    
                     
              </Items>

   </ext:FieldSet>




        </Items>

     
  
</ext:FormPanel>



     <ext:Window 
            ID="Ventana_Asesor" 
            runat="server" 
            Icon="Package"
            Closable="true"
            Title="Registro de Asesores "
            Width="600"
            Height="350"
            Resizable="false"
          
            BodyPadding="5" 
            Hidden="false"
            Layout="Form" 
            UI ="Warning">
            <Items>
               
                
                <ext:Panel ID="Panel2" runat="server" Header="false" Border="false" Layout="FitLayout">
                    <Content>
                        



               <%--Contenedor de datos de Asesor --%>

               <ext:FieldSet runat="server"    Title="DATOS DEL NUEVO ASESOR"   DefaultAnchor="100%">

                <Defaults>
               <ext:Parameter Name="labelWidth" Value="89" Mode="Raw" />
                </Defaults>
                <Items>
               
                             
                          
              <%--Cedula del Identificacion--%>
                    
              <ext:FieldContainer   runat="server"     FieldLabel="Identificación" AnchorHorizontal="100%" Layout="HBoxLayout">                
                     <Items>
                    
                    <ext:NumberField   ID="Txt_Identificacion" runat="server" MaxLeng="20"  AllowBlank="false" Width="200"  EmptyText="Digite la identificacion"  />  
                     
                </Items>
            </ext:FieldContainer>


                  
                   
           
         <%-- Nombres del Asesro--%>
             <ext:FieldContainer   runat="server"     FieldLabel="Nombres" AnchorHorizontal="100%" Layout="HBoxLayout">     
                <Items>
                    
                 <ext:TextField   ID="Txt_nombres" runat="server" Width="250" Margins="0 3 0 0" ReadOnly="false"/>     
                     
                </Items>
            </ext:FieldContainer>         
                 


                   
       <%-- Apellido del Asesesor--%>
             <ext:FieldContainer   runat="server"     FieldLabel="Apellidos" AnchorHorizontal="100%" Layout="HBoxLayout">     
                <Items>
                    
                 <ext:TextField   ID="Txt_Apellidos" runat="server" Width="250" Margins="0 3 0 0" ReadOnly="false"/>     
                     
                </Items>
            </ext:FieldContainer>         
                 


             <%--Cedula del Identificacion--%>
                    
              <ext:FieldContainer   runat="server"     FieldLabel="Telefono" AnchorHorizontal="100%" Layout="HBoxLayout">                
                     <Items>
                    
                           <ext:TextField   ID="Txt_Telefono" runat="server" Width="250" Margins="0 3 0 0" ReadOnly="false">   
                                <Plugins>
                                      <ext:InputMask runat="server" Mask="(999) 999-9999" Placeholder="#" AlwaysShow="true" />
                           </Plugins>  
                          
                   </ext:TextField>
                     
                </Items>
            </ext:FieldContainer>        
            




             
       <%-- Apellido del Correo--%>
             <ext:FieldContainer   runat="server"     FieldLabel="Email" AnchorHorizontal="100%" Layout="HBoxLayout">     
                <Items>
 
                     <ext:TextField ID="Txt_Correo" runat="server" Vtype="email" />  
                </Items>
            </ext:FieldContainer>         
                 





               <%--Fecha finalizacion contrato--%>

         <ext:FieldContainer   runat="server"     FieldLabel="Fecha Fin. Cont." AnchorHorizontal="100%" Layout="HBoxLayout">     
               
                <Items>  
                     <ext:DateField 
                    ID="Dt_Fecha_FinContr" 
                    runat="server" 
                                      
                      EmptyText="Fecha de finalización del contrato"
                    >
                   
                 </ext:DateField>

                   </Items>
               </ext:FieldContainer>

                         <%--Lista de roles del Asesor--%>

    <ext:FieldContainer   runat="server"     FieldLabel="Rol " AnchorHorizontal="100%" Layout="HBoxLayout">     
           <Items>  
                      <ext:MultiCombo runat="server" Width="260"   ValueField="Id_Rol"  EmptyText="Seleccione el Rol" >
                            <Store>
                                 <ext:Store runat="server" ID="StrRol">
                                <Model>
                                        <ext:Model runat="server">
                                        <Fields>
                                        <ext:ModelField Name="Id_Rol" Type="Int" />
                                        <ext:ModelField Name="Nomb_Rol" Type="String"/>
                                        </Fields>
                                        </ext:Model>
                                 </Model>            
                                </ext:Store>    
                            </Store> 
                         </ext:MultiCombo>
                </Items>
             </ext:FieldContainer>
                  

                 




        </Items>

            </ext:FieldSet>



 

                    </Content>


                </ext:Panel>
            </Items>
            <Buttons>
                <ext:Button ID="Btn_Registrar_Asesor_Nuevo" runat="server" Text="Guardar" Icon="Add">
                    <DirectEvents>
                        <Click OnEvent="Btn_Registrar_Asesor_Nuevo_Click">
                            <EventMask ShowMask="true" Msg="Saving..." MinDelay="500" />
                        </Click>
                    </DirectEvents>
                </ext:Button>
            </Buttons>

        <Buttons>
                <ext:Button ID="Btn_Eliminar_Asesor_Nuevo" runat="server" Text="Eliminar" Icon="Delete">
                    <DirectEvents>
                        <Click OnEvent="Btn_Eliminar_Asesor_Nuevo_Click">
                            <EventMask ShowMask="true" Msg="Saving..." MinDelay="500" />
                        </Click>
                    </DirectEvents>
                </ext:Button>
            </Buttons>





        </ext:Window>






    </form>
</body>
</html>


